package com.uchiha.nova.mainService.provider;

import com.uchiha.nova.mainService.listener.MyRedisSubscribeListener;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 周林静
 * @Date 2022-01-01 9:30
 * @Version 1.0
 */
public class TokenProvider {

    public static Map<String,String> TokenCheck = new HashMap<>();

    public static String getTokenKey(String url){
        String token = String.valueOf(System.currentTimeMillis());
        TokenCheck.put(token,url);
        return token;
    }

    public static Boolean checkTokenKey(String token,String url){
       String urlUnCheck =  TokenCheck.get(token);
        if(urlUnCheck.equals(url)){
            TokenCheck.remove(token);
            return true;
        }else{
            return false;
        }
    }
}
